package com.xypower.any;

import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
//字符串的字符按一定顺序排列
public class LowestLexicography {
    public static class MyComparator implements Comparator<String>{
        //字典序比较
        @Override
        public int compare(String a, String b) {
            return (a + b).compareTo(b + a);
        }
    }
    public static String lowestString(String[] strs){
        if (strs == null || strs.length==0){
            return "";
        }
        Arrays.sort(strs,new MyComparator());
        String res = "";
        for (int i = 0; i < strs.length; i++){
            res += strs[i];
        }
        return res;
    }
}
